package interview.huawei;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class MyCircularQueueTest {
    @Test
    public void test() {
        final MyCircularQueue circularQueue = new MyCircularQueue(3);
        Assertions.assertTrue(circularQueue.enQueue(2)); // 返回 true
        Assertions.assertTrue(circularQueue.enQueue(3)); // 返回 true
        Assertions.assertTrue(circularQueue.enQueue(1)); // 返回 true
        Assertions.assertFalse(circularQueue.enQueue(4)); // 返回 false，队列已满
        Assertions.assertEquals(1, circularQueue.Rear()); // 返回 3
        Assertions.assertTrue(circularQueue.isFull()); // 返回 true
        Assertions.assertTrue(circularQueue.deQueue()); // 返回 true
        Assertions.assertTrue(circularQueue.enQueue(4));// 返回 true
        Assertions.assertEquals(4, circularQueue.Rear()); // 返回 4

    }
}
